<!DOCTYPE html>
<html>
<base href="__STATIC__/admin/">
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="renderer" content="webkit">

    <title>商品添加</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link href="css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="font-awesome/css/font-awesome.css?v=4.3.0" rel="stylesheet">
    <link href="css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css?v=2.2.0" rel="stylesheet">

</head>

<body>
    <div id="wrapper">
        <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="sidebar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="nav-header">

                        <div class="dropdown profile-element"> <span>
                            <img alt="image" class="img-circle" src="img/profile_small.jpg" />
                             </span>
                            <a data-toggle="dropdown" class="dropdown-toggle" href="index.html#">
                                <span class="clear"> <span class="block m-t-xs"> <strong class="font-bold">Beaut-zihan</strong>
                             </span>  <span class="text-muted text-xs block">超级管理员 <b class="caret"></b></span> </span>
                            </a>
                            <ul class="dropdown-menu animated fadeInRight m-t-xs">
                                <li><a href="form_avatar.html">修改头像</a>
                                </li>
                                <li><a href="profile.html">个人资料</a>
                                </li>
                                <li><a href="contacts.html">联系我们</a>
                                </li>
                                <li><a href="mailbox.html">信箱</a>
                                </li>
                                <li class="divider"></li>
                                <li><a href="login.html">安全退出</a>
                                </li>
                            </ul>
                        </div>
                        <div class="logo-element">
                            H+
                        </div>

                    </li>
                    <li>
                        <a href="index.html"><i class="fa fa-th-large"></i> <span class="nav-label">用户管理</span> <span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="index_1.html">用户列表</a>
                            </li>
                        </ul>
                    </li>
                    <li class="active">
                        <a href="layouts.html"><i class="fa fa-columns"></i> <span class="nav-label">商品管理</span><span class="label label-danger pull-right"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="{:url('admin/goods/goodslist')}">商品列表</a>
                            </li>
                            <li><a href="{:url('admin/goods/addgoods')}">商品添加</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="index.html#"><i class="fa fa fa-globe"></i> <span class="nav-label">管理员管理</span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="toastr_notifications.html">管理员列表</a>
                            </li>
                        </ul>
                    </li>

                    <li>
                        <a href="index.html#"><i class="fa fa-bar-chart-o"></i> <span class="nav-label">轮播图管理</span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="{:url('admin/slideshow/slideshowlist')}">轮播图列表</a>
                            </li>
                            <li><a href="{:url('admin/slideshow/addslideshow')}">轮播图添加</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="mailbox.html"><i class="fa fa-envelope"></i> <span class="nav-label">广告位管理 </span><span class="label label-warning pull-right"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="mailbox.html">广告位列表</a>
                            </li>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="widgets.html"><i class="fa fa-flask"></i> <span class="nav-label">品牌管理</span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="mailbox.html">品牌列表</a>
                            </li>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="index.html#"><i class="fa fa-edit"></i> <span class="nav-label">商品分类管理</span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="form_basic.html">分类列表</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="index.html#"><i class="fa fa-desktop"></i> <span class="nav-label">评价管理</span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="contacts.html">评价列表</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="index.html#"><i class="fa fa-files-o"></i> <span class="nav-label">投诉管理</span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="search_results.html">投诉列表</a>
                            </li>
                        </ul>
                    </li>

                    <li>
                        <a href="index.html#"><i class="fa fa-flask"></i> <span class="nav-label">商家管理</span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="typography.html">商家列表</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="grid_options.html"><i class="fa fa-laptop"></i> <span class="nav-label">系统设置</span></a>
                    </li>

                </ul>

            </div>
        </nav>
        <div id="page-wrapper" class="gray-bg dashbard-1">
            <div class="row border-bottom">
                <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                    <div class="navbar-header">
                        <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="form_basic.html#"><i class="fa fa-bars"></i> </a>
                        <form role="search" class="navbar-form-custom" method="post" action="search_results.html">
                            <div class="form-group">
                                <input type="text" placeholder="请输入您需要查找的内容 …" class="form-control" name="top-search" id="top-search">
                            </div>
                        </form>
                    </div>
                    <ul class="nav navbar-top-links navbar-right">
                        <li>
                            <span class="m-r-sm text-muted welcome-message"><a href="index.html" title="返回首页"><i class="fa fa-home"></i></a>欢迎使用H+后台主题</span>
                        </li>
                        <li class="dropdown">
                            <a class="dropdown-toggle count-info" data-toggle="dropdown" href="index.html#">
                                <i class="fa fa-envelope"></i>  <span class="label label-warning">16</span>
                            </a>
                            <ul class="dropdown-menu dropdown-messages">
                                <li>
                                    <div class="dropdown-messages-box">
                                        <a href="profile.html" class="pull-left">
                                            <img alt="image" class="img-circle" src="img/a7.jpg">
                                        </a>
                                        <div class="media-body">
                                            <small class="pull-right">46小时前</small>
                                            <strong>小四</strong> 项目已处理完结
                                            <br>
                                            <small class="text-muted">3天前 2014.11.8</small>
                                        </div>
                                    </div>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <div class="dropdown-messages-box">
                                        <a href="profile.html" class="pull-left">
                                            <img alt="image" class="img-circle" src="img/a4.jpg">
                                        </a>
                                        <div class="media-body ">
                                            <small class="pull-right text-navy">25小时前</small>
                                            <strong>国民岳父</strong> 这是一条测试信息
                                            <br>
                                            <small class="text-muted">昨天</small>
                                        </div>
                                    </div>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <div class="text-center link-block">
                                        <a href="mailbox.html">
                                            <i class="fa fa-envelope"></i>  <strong> 查看所有消息</strong>
                                        </a>
                                    </div>
                                </li>
                            </ul>
                        </li>
                        <li class="dropdown">
                            <a class="dropdown-toggle count-info" data-toggle="dropdown" href="index.html#">
                                <i class="fa fa-bell"></i>  <span class="label label-primary">8</span>
                            </a>
                            <ul class="dropdown-menu dropdown-alerts">
                                <li>
                                    <a href="mailbox.html">
                                        <div>
                                            <i class="fa fa-envelope fa-fw"></i> 您有16条未读消息
                                            <span class="pull-right text-muted small">4分钟前</span>
                                        </div>
                                    </a>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <a href="profile.html">
                                        <div>
                                            <i class="fa fa-qq fa-fw"></i> 3条新回复
                                            <span class="pull-right text-muted small">12分钟钱</span>
                                        </div>
                                    </a>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <div class="text-center link-block">
                                        <a href="notifications.html">
                                            <strong>查看所有 </strong>
                                            <i class="fa fa-angle-right"></i>
                                        </a>
                                    </div>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href="login.html">
                                <i class="fa fa-sign-out"></i> 退出
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>
            <div class="wrapper wrapper-content animated fadeInRight">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>商品添加</h5>
                                <div class="ibox-tools">
                                    <a class="collapse-link">
                                        <i class="fa fa-chevron-up"></i>
                                    </a>
                                    <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
                                        <i class="fa fa-wrench"></i>
                                    </a>
                                    <ul class="dropdown-menu dropdown-user">
                                        <li><a href="form_basic.html#">选项1</a>
                                        </li>
                                        <li><a href="form_basic.html#">选项2</a>
                                        </li>
                                    </ul>
                                    <a class="close-link">
                                        <i class="fa fa-times"></i>
                                    </a>
                                </div>
                            </div>
                            <div class="ibox-content">
                                <form method="post" class="form-horizontal" action="{:url('goods/addgoodsdo')}" enctype="multipart/form-data">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">商品名称：</label>

                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" name="g_name">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                            <label class="col-sm-2 control-label">商品图片：</label>

                                            <div class="col-sm-10">
                                                <input type="file" class="form-control" name="g_url">
                                            </div>
                                    </div>

                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">所属品牌：</label>

                                        <div class="col-sm-10">
                                            <select class="form-control m-b" name="b_id">

                                                <?php foreach($bdata as $key=>$v) { ?>
                                                <option value="<?=$v['b_id']?>"><?=$v['b_name']?></option>
                                                <?php } ?>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">商品分类：</label>
                                        <div class="col-sm-10">
                                            <select class="form-control m-b" name="c_id" id="category">
                                                <option value="0">请选择</option>
                                                <?php foreach($cate as $key =>$v){ ?>
                                                <?php if($v['c_pid']==0){ ?>
                                                <option value="<?= $v['c_id'] ?>" where="<?= $v['c_pid'] ?>"><?= $v['c_name'] ?></option>
                                                <?php }else{?>
                                                <option value="<?= $v['c_id'] ?>" where="<?= $v['c_pid'] ?>">&nbsp;&nbsp;&nbsp;&nbsp;<?= $v['c_name'] ?></option>
                                                <?php } ?>
                                                <?php } ?>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">商品属性：</label>
                                        <div class="col-sm-10">
                                            <select class="form-control m-b" name="a_id" id="cate">
                                                <option value="0">请选择</option>
                                                <?php foreach($tdata as $key =>$v){ ?>
                                                <option value="<?= $v['type_id'] ?>"><?= $v['type_name'] ?></option>
                                                <?php } ?>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="hr-line-dashed" id="b" hidden></div>
                                    <div class="form-group" id="a" style="display: none;">
                                        <label class="col-sm-2 control-label">属性：
                                        </label>
                                        <div class="col-sm-10">
                                            <div class="checkbox i-checks" id="shux">

                                            </div>
                                        </div>
                                    </div>

                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">商品价格：</label>

                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" name="g_price">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">商品编号：</label>

                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" name="g_number">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">所属店铺：</label>
                                        <div class="col-sm-10">
                                            <select class="form-control m-b" name="m_id">
                                                <?php foreach($mdata as $key=>$v) { ?>
                                                <option value="<?=$v['m_id']?>"><?=$v['m_name']?></option>
                                                <?php } ?>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">商品描述：</label>

                                        <div class="col-sm-10">
                                            <input type="text" placeholder="" class="form-control" name="g_content">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">商品库存：</label>

                                        <div class="col-sm-10">
                                            <input type="text" placeholder="" class="form-control" name="g_num">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">商品广告语：</label>

                                        <div class="col-sm-10">
                                            <input type="text" placeholder="" class="form-control" name="g_intro">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">是否上架：</label>

                                            <div class="col-sm-10">
                                                <input type="checkbox" value="1" id='gisdel' name="g_is_del" checked>&nbsp;&nbsp;(√为上架，否则不上架！)
                                            </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <div class="col-sm-4 col-sm-offset-2">
                                            <button class="btn btn-primary" type="submit">保存内容</button>
                                            <button class="btn btn-white" type="submit">取消</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    </div>
    <div id="modal-form" class="modal fade" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="row">
                        <div class="col-sm-6 b-r">
                            <h3 class="m-t-none m-b">登录</h3>

                            <p>欢迎登录本站(⊙o⊙)</p>

                            <form role="form">
                                <div class="form-group">
                                    <label>用户名：</label>
                                    <input type="email" placeholder="请输入用户名" class="form-control">
                                </div>
                                <div class="form-group">
                                    <label>密码：</label>
                                    <input type="password" placeholder="请输入密码" class="form-control">
                                </div>
                                <div>
                                    <button class="btn btn-sm btn-primary pull-right m-t-n-xs" type="submit"><strong>登录</strong>
                                    </button>
                                    <label>
                                        <input type="checkbox" class="i-checks">自动登录</label>
                                </div>
                            </form>
                        </div>
                        <div class="col-sm-6">
                            <h4>还不是会员？</h4>
                            <p>您可以注册一个账户</p>
                            <p class="text-center">
                                <a href="form_basic.html"><i class="fa fa-sign-in big-icon"></i></a>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Mainly scripts -->
    <script src="js/jquery-3.1.1.min.js"></script>

    <!-- Custom and plugin javascript -->
    <script src="js/hplus.js?v=2.2.0"></script>
    <script src="js/plugins/pace/pace.min.js"></script>

    <!-- iCheck -->
    <script>
        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });
        });
        $(document).on("change","#cate",function(){
            var type_id = $(this).val();
            var _this = $(this);
            if (type_id==0) {
                $("#a").hide();
                $("#b").hide();
                return;
            }
            $.ajax({
                data:{type_id:type_id},
                url:"{:url('admin/goods/addgoods')}",
                success:function(e){
                        $("#a").show();
                        $("#b").show();
                        tr = '';
                        $.each(JSON.parse(e),function (v,a) {
                            tr += '<p><input type="hidden" value="'+a.a_id+'" name="a_id[]"><label>';
                            tr += a.a_name+'：<input type="text" placeholder="" name="a_name[]">&nbsp;&nbsp;&nbsp;对应价格：<input type="text" placeholder="" name="a_price[]"><span class="addRow">[+]</span>';
                            tr += '</label></p>&nbsp;&nbsp;';
                        });
                        $("#shux").empty();
                        $("#shux").wrapInner(tr);
                }
            })
        })
        $(document).on("click",".addRow",function(){
            // 找到tr
            var tr = $(this).parent().parent();
            // 找加号
            var value = $(this).text();
            // 判断是否是+号
            if(value == '[+]' ){
                $(this).text('[-]');
                // 复制一份
                var tr_clone = tr.clone();
                tr.after(tr_clone);
                // 再改回【+】  你点击的时候
                $(this).text('[+]');
            }else{
                tr.remove();
            }

        })
        $(document).on("click","#gisdel",function(){
            var checked = $(this).prop('checked');
            if (checked==true){
               var g_is_del = 1;
            }else{
                g_is_del = 0;
            }
            $.ajax({
                url:"{:url('goods/addgoodsdo')}",
                data:{g_is_del:g_is_del},
                success:function(e){
                    
                }
            })
        })
    </script>
    <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script><!--统计代码，可删除-->
</body>
</html>